package org.codingq92.project.bio_chat.server;

import org.codingq92.project.bio_chat.util.Constants;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;

/**
 * 聊天室服务端
 *
 * @author: CodingQ92
 * @date: 2025/6/24 23:07
 */
public class ChatServer {
    public static final Map<Socket, String> onlineUsers = new HashMap<>();

    public static void main(String[] args) {
        try {
            ServerSocket serverSocket = new ServerSocket(Constants.SERVER_PORT);
            while (true) {
                Socket socket = serverSocket.accept();
                new ChatServerHandler(socket).start();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
